﻿using System;
using System.Runtime.Serialization;

namespace CC.Yacht
{
    [DataContract]
    public class User : IComparable<User>, IEquatable<User>
    {
        #region Constructor
        public User() : this(-1, string.Empty)
        {
            // Empty Constructor    
        }

        public User(long userId, string username)
        {
            UserId = userId;
            Username = username;
        }
        #endregion

        #region Public Properties
        [DataMember]
        public long UserId { get; set; }

        [DataMember]
        public string Username { get; set; }
        #endregion

        #region Public Methods
        //public static bool operator == (User user1, User user2)
        //{
        //    return user1.Equals(user2);
        //}

        //public static bool operator !=(User user1, User user2)
        //{
        //    return !user1.Equals(user2);
        //}

        public int CompareTo(User other)
        {
            int returnValue = -1;

            if (other != null)
            {
                returnValue = UserId.CompareTo(other.UserId);
            }

            return returnValue;
        }

        public bool Equals(User other)
        {
            bool returnValue = false;

            if (other != null)
            {
                returnValue = (UserId == other.UserId);
            }

            return returnValue;
        }
        #endregion
    }
}
